import React, { useContext } from 'react';
import SchHead from './components/SchHead';
import SchList from './components/SchList';
import SchTable from './components/SchTable';
import { ScheduleContext } from './SchContext';

const SchBox = ({ onSelect, onEventClick, onCheck,handleDelTest }) => {
  const ctx = useContext(ScheduleContext);
  // const userCtx = useContext(UserContext);
  return (
    <div className="sch">
      <SchHead />
      {ctx.dateUnit === 'LIST' ? (
        <SchList onEventClick={onEventClick} onCheck={onCheck} onSelect={onSelect} handleDelTest={ handleDelTest}/>
      ) : (
        <SchTable onSelect={onSelect} onEventClick={onEventClick} onCheck={onCheck} handleDelTest={ handleDelTest}/>
      )}
    </div>
  );
};

export default SchBox;
